package com.vastcom.springbootangular5.service.impl;

import com.vastcom.springbootangular5.model.Authority;
import com.vastcom.springbootangular5.repository.AuthorityRepository;
import com.vastcom.springbootangular5.service.AuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class AuthorityServiceImpl implements AuthorityService {
    @Autowired
    private AuthorityRepository authorityRepository;




    @Override
    public List<Authority> findById(Long id) {
        Authority auth=this.authorityRepository.findOne(id);
        List<Authority> auths=new ArrayList<>();
        auths.add(auth);
        return auths;
    }

    @Override
    public List<Authority> findByname(String name) {
       Authority auth=this.authorityRepository.findAuthoritiesByName(name);
       List<Authority> auths=new ArrayList<>();
       auths.add(auth);
       return auths;
    }
}
